package com.xnewtech.xplatform.swan.mtm.modular.modname.controller;


import com.xnewtech.xplatform.swan.libs.scanner.annotation.PostResource;
import com.xnewtech.xplatform.swan.libs.scanner.stereotype.ApiResource;
import com.xnewtech.xplatform.swan.model.web.response.ResponseData;
import com.xnewtech.xplatform.swan.mtm.modular.modname.entity.DmDevDbInfo;
import com.xnewtech.xplatform.swan.mtm.modular.modname.service.DmDevDbInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (DmDevDbInfo)表控制层
 *
 * @author mhq
 * @since 2021-09-22 15:20:14
 */

@RequestMapping("dmDevDbInfo")
@RestController
@ApiResource(name = "数据库管理", path = "/dmDevDbInfo")
@Api(tags = "dm_dev_db_info表")
public class DmDevDbInfoController {
    /**
     * 服务对象
     */
    @Resource
    private DmDevDbInfoService dmDevDbInfoService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @PostResource(name = "添加", path = "/selectOne")
    @ApiOperation("通过id查询")
    public ResponseData selectOne(Long id) {
        dmDevDbInfoService.queryById(id);
        return ResponseData.success();
    }


    /**
     * 添加数据库
     * @param dmDevDbInfo
     * @return
     */
    @PostResource(name = "添加", path = "/add")
    @ApiOperation("新增")
    public ResponseData add(@RequestBody DmDevDbInfo dmDevDbInfo) {

        dmDevDbInfoService.add(dmDevDbInfo);
        return ResponseData.success();
    }
    /**
     * 修改数据库信息
     * @param dmDevDbInfo
     * @return
     */
    @PostResource(name = "修改", path = "/update")
    @ApiOperation("修改")
    public ResponseData update(@RequestBody DmDevDbInfo dmDevDbInfo) {
        dmDevDbInfoService.update(dmDevDbInfo);
        return ResponseData.success();
    }

}